package top.itlir.edc.service.impl;

import javax.annotation.Resource;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import top.itlir.edc.dao.DeliveryInfoRepository;
import top.itlir.edc.dao.TransitInfoRepository;
import top.itlir.edc.domain.DeliveryInfo;
import top.itlir.edc.domain.TransitInfo;
import top.itlir.edc.service.IDeliveryInfoService;

@Service
@Transactional
public class DeliveryInfoServiceImpl implements IDeliveryInfoService {

	@Resource
	private DeliveryInfoRepository deliveryInfoRepository;
	
	@Autowired
	private TransitInfoRepository transitInfoRepository;

	@Override
	public void save(DeliveryInfo model, Integer transitInfoId) {
		deliveryInfoRepository.save(model);
		
		TransitInfo transitInfo = transitInfoRepository.findOne(transitInfoId);
		transitInfo.setDeliveryInfo(model);
		
		transitInfo.setStatus("开始配送");
	}

}
